﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="iSelgood.aspx.cs" Inherits="SellerProject.iSelgood" %>
<%@ Register Assembly="AspNetPager" Namespace="Wuqi.Webdiyer" TagPrefix="webdiyer" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>请选择发布商品！</title>
    <script type="text/javascript" src="Scripts/jquery.js" ></script>
    <script type="text/javascript" src="Scripts/jquery.loadthumb.js"></script>
    <link href="Css/comon.css" rel="stylesheet" type="text/css" />
    <link href="Css/sellframe.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript" language="javascript">
        function CustomSubmit(msg) {
            var form = document.getElementById('<%=form1.ClientID %>');
            document.getElementById('hID').value = confirm(msg);
            form.submit();
        }
    </script>
<script type="text/javascript" language="javascript">
    $(document).ready(function () {
        ResizeImg();
        parent.ifmReSize();
    });   //documentready

    function SetPromotion(obj) {
        if ($(obj).text() == "设置优惠") {
            $(obj).next().val("true");
            $(obj).parent().hide();
            $(obj).parent().next().slideDown("fast");
        }
        else {
            $(obj).next().val("false");
            $(obj).text("设置优惠");
            $(obj).prev().text("优惠已取消！");
        }
    }
    
    function ResizeImg() {
        var imgcount = $(".imgcss").length;
        for (var i = 0; i < imgcount; i++) {
            $($(".imgcss")[i]).loadthumb({
                "src": $(".imgcss")[i].src,
                "imgId": $(".imgcss")[i].id,
                "parentId": $($(".imgcss")[i]).parent()[0].id
            });
        };


        $(":checkbox").change(function () { if (this.checked == true) { $(this).parent().parent().hide(); $(this).parent().parent().next().slideDown("fast"); } else { $(this).parent().parent().next().hide(); $(this).parent().parent().slideDown("fast"); } });
        $(".disType").change(function () { if ($(this).val() == "PRICE") { $(this).nextAll().eq(0).hide(); $(this).nextAll().eq(1).show(); } else { $(this).nextAll().eq(1).hide(); $(this).nextAll().eq(0).show(); } });

        $(".disCommit").click(function () {
            var dismsg = "优惠信息：";
            var ddobj = $(this).prev();
            var diobj = $(this).parent().prev();
            ddobj.children().each(function () {
                if ($(this).css("display") != "none") {
                    if ($(this).val() == "DISCOUNT") { dismsg += "折扣"; }
                    else if ($(this).val() == "PRICE") { dismsg += "优惠价格"; }
                    else if (dismsg == "折扣") { dismsg += "：" + $(this).val() + "折"; }
                    else if (dismsg == "优惠价格") { dismsg += "：" + $(this).val() + "元"; }
                    else { dismsg += "，" + $(this).val() + "小时"; }
                }
            });
            diobj.children().eq(0).text(dismsg);
            diobj.children().eq(1).text("取消优惠");
            ddobj.parent().hide();
            diobj.slideDown();
        });
    }
    function showResult(msg) {
        parent.showResult(msg);
    }
//    function () {
//        if ($.browser.msie) {
//            $("input:checkbox").click(function () {
//                this.blur();
//                this.focus();
//            });
//        }
//    }
</script>

</head>
<body>
    <form id="form1" runat="server">
    <input type="hidden" id="hID" name="hName" />
    <input type="hidden" id="hnid" name="hNid" />
        <div id="ifrmcontent" class="textArea">
            <asp:ScriptManager ID="ScriptManager1" runat="server">
            </asp:ScriptManager>
            <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                <ContentTemplate>
               <asp:GridView ID="gridvselgood" runat="server" AutoGenerateColumns="False" EnableModelValidation="True" GridLines="None" BorderStyle="None" ShowHeader="False" UseAccessibleHeader="False" onrowcommand="gridvselgood_RowCommand" onrowcreated="gridvselgood_RowCreated">
                    <Columns>
                        <asp:TemplateField>
                            <ItemTemplate>
                             <div class="onsellShow clearfix">
                                <div class="onsellTitle">
                                    <h3>
                                     <asp:Label ID="LabTitle" runat="server" Text='<%# Eval("Title").ToString().Length > 24 ? Eval("Title").ToString().Substring(0, 24) + "..." : Eval("Title").ToString() %>'></asp:Label></h3>
                                     <div>
                                        <asp:LinkButton ID="selgoodCommit" runat="server" CommandName="insert" CommandArgument='<%# Eval("NumIid") %>'>发布这个商品</asp:LinkButton>
                                     </div>
                                </div>
                               </div>

                                <div class="onsellDetail">
                                    <div class="imgField" id="imgparent">
                                        <asp:Image ID="imgImgurl" CssClass="imgcss" runat="server" ImageUrl='<%# Eval("PicUrl") %>' />
                                      </div>

                                    <div class="disCount">
                                     <div class="disInfo">
                                        <label class="disMsg">此商品还未设置打折信息</label>
                                        <a runat="server" ID="disOF" class="disOnOff" onclick='SetPromotion(this)'>设置优惠</a>
                                         <asp:HiddenField ID="setPromo" runat="server" Value="0" />
                                      </div>

                                     <div class="disDetail hidden"><div>
                                        <asp:DropDownList ID="disType" CssClass="disType" runat="server" 
                                            EnableTheming="False" ToolTip="优惠方式" AutoPostBack="False">
                                            <asp:ListItem Value="DISCOUNT">折扣：</asp:ListItem>
                                            <asp:ListItem Value="PRICE">优惠价：</asp:ListItem>
                                        </asp:DropDownList>
                                         <asp:DropDownList ID="disValue2" CssClass="disValue" runat="server">
                                         </asp:DropDownList>
                                        <asp:TextBox ID="disValue" CssClass="disValue hidden" runat="server" Text="请输入优惠价格！" 
                                             EnableTheming="False" MaxLength="8" TextMode="SingleLine" 
                                            Wrap="False" ToolTip="折扣率，打折请输入X.X，优惠价请直接输入价格" Width="100px" onfocus="if(this.value=='请输入优惠价格！'){this.value='';}" onKeyPress="if((event.keyCode<48 || event.keyCode>57) && event.keyCode!=46 || /\.\d\d$/.test(value))event.returnValue=false" ></asp:TextBox>
                                        <asp:DropDownList ID="disData" CssClass="disData" runat="server" 
                                            EnableTheming="False" ToolTip="优惠时间">
                                            <asp:ListItem Value="6">6小时</asp:ListItem>
                                            <asp:ListItem Value="12">12小时</asp:ListItem>
                                            <asp:ListItem Value="18">18小时</asp:ListItem>
                                            <asp:ListItem Value="24">24小时</asp:ListItem>
                                        </asp:DropDownList></div>
                                        <a class="disCommit" onclick="return false;">确定</a>
                                      </div>
                                    </div>
                                    <div class="textField">
                                        <asp:Label ID="lablePrice" runat="server" Text='<%#  "<strong class=pricearea>" + Eval("Price") + "</strong>" %>'></asp:Label>
                                        <asp:Label ID="lableNum" runat="server" Text='<%# "库存：" + Eval("num")%>'></asp:Label>
                                        <asp:Label ID="lableValidThru" runat="server" Text='<%# "有效期：" + Eval("ValidThru") + "天"%>'></asp:Label>
                                     </div>
                                 </div>
                            </ItemTemplate>
                        </asp:TemplateField>
                    </Columns>
                    <EmptyDataTemplate>
                        <div class="onsellShow clearfix"><div class="textArea">
                            <div id="nogoods" style=""><dl><dt>没有查询到商品！可能由于以下原因造成：</dt><dd>您还没有在淘宝网上开店！</dd><dd>您店铺中此类目下暂时没有商品处于出售中！</dd></dl></div>
                        </div></div>
                    </EmptyDataTemplate>
                </asp:GridView>
                <webdiyer:AspNetPager ID="grPager" runat="server" 
                        CurrentPageButtonPosition="End" 
                        CustomInfoHTML="共%PageCount%页，当前为第%CurrentPageIndex%页" FirstPageText="首页" 
                        LastPageText="尾页" NextPageText="后页" onpagechanged="grpager_PageChanged" 
                        PageIndexBoxType="TextBox" PageSize="6" PrevPageText="前页" 
                        ShowCustomInfoSection="Left" ShowPageIndexBox="Never" SubmitButtonText="Go" 
                        TextAfterPageIndexBox="页" TextBeforePageIndexBox="转到" 
                        NumericButtonCount="4" CssClass="pagertext" Height="10px" Wrap="False"></webdiyer:AspNetPager>
                </ContentTemplate>
                <Triggers>
                    <asp:AsyncPostBackTrigger ControlID="grpager" EventName="PageChanged" />
                    <asp:AsyncPostBackTrigger ControlID="gridvselgood" EventName="RowCommand" />
                </Triggers>
            </asp:UpdatePanel> 
            </div>
    </form>
</body>
</html>
